<?php

namespace Api\Controller;


class GongyituController extends CommonController
{

   
    function getCateNameAttr($value, $data){
        $kwp_model = M('imgcate');
        $kwp_wdata['id'] = $data['cate_id'];
        $title = $kwp_model->where($kwp_wdata)->getField('title');
        return $title;
    }
 

     //添加前置
     public function _before_add() {
        if(!I('title')){
            $this->ajaxErrReturn('标题必须');
        }
        if(!I('pic')){
            $this->ajaxErrReturn('图片必须');
        }
    }

     //编辑前置
     public function _before_edit() {
        if(!I('title')){
            $this->ajaxErrReturn('标题必须');
        }
        if(!I('pic')){
            $this->ajaxErrReturn('图片必须');
        }
    }


}
